package com.sh.data.engine.repository.dao.datadev;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sh.data.engine.repository.dao.datadev.entity.FlinkJobEntity;

/**
 * @Author: zigui.zdf @Date: 2022/3/16 16:58:35 @Description:
 */
public interface FlinkJobMapper extends BaseMapper<FlinkJobEntity> {
    //  @Autowired MongoPageHelper mongoPageHelper;
    //
    //  public FlinkJobEntity getJobByNodeIdAndExecType(String nodeId, Integer execType) {
    //    Query query = new Query();
    //    query.addCriteria(Criteria.where("nodeId").is(nodeId).and("execType").is(execType));
    //    return findOne(query);
    //  }
    //
    //  public List<FlinkJobEntity> getRunningJobList() {
    //
    //    Query query = new Query();
    //    query.addCriteria(Criteria.where("status").is(FlinkJobStatusEnum.RUNNING.getCode()));
    //    return findMulti(query);
    //  }
    //
    //  /**
    //   * <select id="getTaskRecordList"
    //   * resultType="com.xuelangyun.hufu.dao.entity.flink.customer.FlinkJobCustomerEntity">
    //   *
    //   * <p>select j.*, n.name as task_name, n.user_id from flink_job j, flink_menu_node n where
    //   * j.task_node_id = n.id and j.exec_type = 1 and j.project_id = #{projectId} <if
    // test="taskName !=
    //   * null and taskName != ''"> and n.name like CONCAT('%',#{taskName},'%') </if> <if
    //   * test="taskStatus != null"> and j.task_status = #{taskStatus} </if> <if test="taskType !=
    // null">
    //   * and j.task_type = #{taskType} </if>
    //   *
    //   * <p><if test="order != null and order != '' "> order by ${order} </if>
    //   *
    //   * <p></select> <select id="getJobStatusList"
    //   * resultType="com.xuelangyun.hufu.dao.entity.flink.FlinkJobRecordEntity"> select task_status
    // as
    //   * taskStatus ,COUNT(*) as taskCount from flink_job where exec_type = 1 and start_time &gt;
    //   * #{start} <if test="projectId != null"> and project_id = #{projectId} </if>
    //   *
    //   * <p><if test="taskType != null"> and task_type = #{taskType} </if> group by task_status
    //   * </select>
    //   */
    //  public PageResult<FlinkJobEntity> getTaskRecordList(
    //      String projectId,
    //      Sort sort,
    //      String taskName,
    //      Integer taskStatus,
    //      Integer taskType,
    //      Integer pageNum,
    //      Integer pageSize) {
    //    Criteria criteria = Criteria.where("projectId").is(projectId);//.and("execType").is(1);
    //
    //    if (Objects.nonNull(taskStatus)) {
    //      criteria.and("status").is(taskStatus);
    //    }
    //    if (Objects.nonNull(taskType)) {
    //      criteria.and("execType").is(taskType);
    //    }
    //    Query query = new Query(criteria);
    //
    //    if (Objects.nonNull(sort)) {
    //      query.with(sort);
    //    }
    //    PageResult<FlinkJobEntity> pageResult =
    //        mongoPageHelper.pageQuery(query, FlinkJobEntity.class, pageSize, pageNum);
    //    return pageResult;
    //  }
    //
    //  /**
    //   * </select> <select id="getJobStatusList"
    //   * resultType="com.xuelangyun.hufu.dao.entity.flink.FlinkJobRecordEntity"> select task_status
    // as
    //   * taskStatus ,COUNT(*) as taskCount from flink_job where exec_type = 1 and start_time &gt;
    //   * #{start} <if test="projectId != null"> and project_id = #{projectId} </if>
    //   *
    //   * <p><if test="taskType != null"> and task_type = #{taskType} </if> group by task_status
    //   * </select>
    //   *
    //   * @return
    //   */
    //  public List<FlinkJobEntity> getJobStatusList(String projectId, Integer taskType, Date start) {
    //    Query query = new Query();
    //    Criteria criteria = new Criteria();
    //    criteria.and("execType").is(1).and("startTime").gt(start);
    //    if (Objects.nonNull(taskType)) {
    //      criteria.and("taskType").is(taskType);
    //    }
    //    if (StringUtils.isNotBlank(projectId)) {
    //      criteria.and("projectId").is(projectId);
    //    }
    //
    //    return findMulti(query);
    //  }
}
